/**
 * Copyright (C) 2013 DaiKit.com - daikit4gxt-sample module (admin@daikit.com)
 *
 *         Project home : http://code.daikit.com/commons
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.daikit.daikit4gxtsample.server.mvc.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


/**
 * The welcome Controller serving the application page
 * 
 * @author tcaselli
 * @version $Revision$ Last modifier: $Author$ Last commit: $Date$
 */
@Controller
public class WelcomeController extends BaseController
{

	private final Log log = LogFactory.getLog(getClass());


	@SuppressWarnings("javadoc")
	@RequestMapping(value =
	{ "/", "/welcome" })
	public String handleRequest(final HttpServletRequest request, final HttpServletResponse response)
	{
		log.debug("[ENTER] handleRequest(...)"); // request=" + request + ", response=" + response + ")") ;
		// final User loggedUser = sessionService.getHttpSessionUser();
		//
		// if (loggedUser == null) {
		// final String applicationLoginUrl = PropertyUtils.getProperty("application.login.url");
		// final String applicationLoginKey = PropertyUtils.getProperty("admin.login.key");
		// final String loginUrlToCall = applicationLoginUrl + "/" + applicationLoginKey;
		// response.setContentType("text/plain");
		// response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
		// response.setHeader("Location", loginUrlToCall);
		// }
		//
		// log.debug("[LEAVE] handleRequest(...)");
		// return loggedUser != null ? new ModelAndView("welcome") : null;
		return "welcome";
	}
}
